package controller;

import domain.Permission;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
import service.IPermissionService;

import javax.annotation.security.RolesAllowed;
import java.util.List;

/**
 * @author ：Yan Guang
 * @date ：Created in 2020/9/25 13:27
 * @description：
 */
@Controller
@RequestMapping("/permission")
public class permissionController {
    @Autowired
    private IPermissionService permissionService;

    @RequestMapping("/findAll.do")
    @RolesAllowed("ADMIN")
    public ModelAndView findAll() throws Exception{
        ModelAndView mv = new ModelAndView();
        List<Permission> permissionList = permissionService.findAll();
        mv.addObject("permissionList",permissionList);
        mv.setViewName("permission-list");
        return mv;
    }
}
